package com.hz.house.controller;
/**
 *  提供给服务内部调用的接口，不需要token验证
 * @author lfw
 */

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.hz.house.bean.vo.CommentReplyMsgCondition;
import com.hz.house.bean.vo.FaqAnswerMsgInfo;
import com.hz.house.common.ResultBean;
import com.hz.house.service.CustomerService;
import com.hz.house.service.SellManService;

@RestController
@RequestMapping("/ms/customer")
public class MicroServiceController {
	
	@Autowired
	private SellManService sellManService;
	
	@Autowired
	private CustomerService customerService;

	/**
	 * <p> 给楼盘服务调用，在回复评论时加分
	 * @param sellManCustomerId
	 * @param customerId
	 * @return
	 */
	@GetMapping("/addReplyScore")
	public ResultBean addScoreOnReplyComment(Integer sellManCustomerId,Integer buildingId) {
		return this.sellManService.addScoreOnReplyComment(sellManCustomerId,buildingId);
	}
	
	/**给楼盘服务调用:获取置业顾问的基本信息*/
	@GetMapping("/getSellManInfo")
	public ResultBean getSellManBasicInfo(Integer sellManCustomerId) {
		return this.sellManService.getSellManBasicInfo(sellManCustomerId);
	}

	/**
	 *  给楼盘服务调用:发送楼盘评论回复的消息
	 * @return
	 */
	@PostMapping("/sendCommentReplyMsg")
	public Object sendBuildingCommentReplyMsg(@RequestBody CommentReplyMsgCondition msg) {
		return this.customerService.sendBuildingCommentReplyMsg(msg);
	}
	
	/**
	 * 给楼盘服务调用:发送楼盘评论点赞的消息
	 * @param msg
	 * @return
	 */
	@PostMapping("/sendCommentPraiseMsg")
	public Object sendBuildingCommentPraiseMsg(@RequestBody CommentReplyMsgCondition msg) {
		return this.customerService.sendBuildingCommentPraiseMsg(msg);
	}
	
	@GetMapping("/getYesterdayStar")
	public Object getYesterdayStar(Integer buildingId) {
		return this.sellManService.getYesterdayStarMicro(buildingId);
	}
	
	@PostMapping("/sendFaqAMsg")
	public Object sendFaqAnsweredMsg(@RequestBody FaqAnswerMsgInfo msg) {
		return this.customerService.sendFaqAnsweredMsg(msg);
	}
	
}
